package com.example.demo;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Service;

@Service
public class MyService implements InitializingBean{
    public MyService() throws Exception {
        Thread.sleep(150);
        System.out.println("MyService created");
    }
    public String getMessage() {
        return "Hello from MyService";
    }
    @PostConstruct
    public void init() throws Exception {
        System.out.println("MyService PostConstruct");
        Thread.sleep(160);
    }
    @Override
    public void afterPropertiesSet() throws Exception {
        Thread.sleep(100);
        System.out.println("MyService afterPropertiesSet");
    }
}